package logic

import (
	"context"
	"week53/common/proto/user"
	"week53/service/server"
)

type UserServer struct {
	user.UnimplementedUserServer
}

func (u UserServer) Register(ctx context.Context, req *user.RegisterReq) (*user.RegisterResp, error) {
	register, err := server.Register(req)
	if err != nil {
		return nil, err
	}
	return register, nil
}

func (u UserServer) Login(ctx context.Context, req *user.LoginReq) (*user.LoginResp, error) {
	login, err := server.Login(req)
	if err != nil {
		return nil, err
	}
	return login, nil
}

func (u UserServer) AddClassPlan(ctx context.Context, req *user.AddClassPlanReq) (*user.AddClassPlanResp, error) {
	addClassPlan, err := server.AddClassPlan(req)
	if err != nil {
		return nil, err
	}
	return addClassPlan, nil
}

func (u UserServer) DelClassPlan(ctx context.Context, req *user.DelClassPlanReq) (*user.DelClassPlanResp, error) {
	delClassPlan, err := server.DelClassPlan(req)
	if err != nil {
		return nil, err
	}
	return delClassPlan, nil
}

func (u UserServer) CarAndOrder(ctx context.Context, req *user.CarAndOrderReq) (*user.CarAndOrderResp, error) {
	carAndOrder, err := server.CarAndOrder(req)
	if err != nil {
		return nil, err
	}
	return carAndOrder, nil
}
